<?php

class Jobseeker_ProfileController extends Zend_Controller_Action
{
	private $identity;
	public function init()
	{
		$authData = Zend_Auth::getInstance ()->getStorage ()->read ();
		//Zend_Registry::get('logger')->debug($authData);
		if (is_array($authData) and $authData['identity'] != 'anon' and $authData) {
			$this->identity = $authData['identity'];
		}
		unset($authData);
	}
	
	public function viewAction()
	{
		$jobSeeker = new RP_Model_User_Jobseeker();
		$jobSeeker->setUsername($this->identity);
		if($jobSeeker->populateUser()){
			//Personal Profile.
			$this->view->assign('name',$jobSeeker->getName());
			$this->view->assign('curr_location',$jobSeeker->getCurr_location());
			$this->view->assign('mobile_no',$jobSeeker->getMobile_no());
			$this->view->assign('alternate_no',$jobSeeker->getAlternate_no());
			
			//Corporate Profile.
			$this->view->assign('exp_years',$jobSeeker->getExp_years());
			$this->view->assign('exp_months',$jobSeeker->getExp_months());
			$this->view->assign('skills',$jobSeeker->getSkills());
			$this->view->assign('resume_headline',$jobSeeker->getResume_headline());
			$this->view->assign('industry_name',$jobSeeker->getIndustry_name());
			$this->view->assign('fa_name',$jobSeeker->getFa_name());
			
			if($jobSeeker->getHighest_qualification()!='UG'){
				$this->view->assign('highest_qualification',$jobSeeker->getHighest_qualification());
				$this->view->assign('course_type',$jobSeeker->getHighest_qualification());
				$this->view->assign('course_name',$jobSeeker->getCourse_name());
				$this->view->assign('edu_spec_name',$jobSeeker->getEdu_spec_name());
				$this->view->assign('edu_org_name',$jobSeeker->getEdu_org_name());
				$this->view->assign('edu_style',$jobSeeker->getEdu_style());
				$this->view->assign('year',$jobSeeker->getYear_of_passing());
			}
			else{
				$this->view->assign('highest_qualification',$jobSeeker->getHighest_qualification());
			}
		}
		else{
			throw new Exception('Username cannot be resolved.', Zend_Log::ERR);
		}
	}
}